`
https://leetcode.cn/problems/generate-parentheses/
`

/**
 * @param {number} n
 * @return {string[]}
 */
var generateParenthesis = function (n) {
  const dp = Array.from({ length: n + 1 }, () => []);
  dp[0] = [''];

  for (let i = 1; i <= n; i++) {
    for (let j = 0; j < i; j++) {
      for (const a of dp[j]) {
        for (const b of dp[i - 1 - j]) {
          dp[i].push(`(${a})${b}`);
        }
      }
    }
  }

  return dp[n];
};